package com.luyue.zagj.adapter;

import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.jude.easyrecyclerview.adapter.BaseViewHolder;
import com.luyue.zagj.R;
import com.luyue.zagj.domin.News;

import java.util.Random;

/**
 * Created by luyue on 2016/11/21.
 */

public class VhicleManaViewHolder  extends BaseViewHolder<News> {

    private ImageView mImg_face;
    private TextView mTv_sign;
    private TextView mTv_brand;
    private TextView mTv_loc;
    private TextView mTv_type;
    public  ImageView check;

    public VhicleManaViewHolder(View itemView) {
        super(itemView);
    }

    public VhicleManaViewHolder(ViewGroup parent) {
        super(parent, R.layout.vehcle_recycler_item);
        mTv_brand = $(R.id.person_brand);
        mTv_sign = $(R.id.person_sign);
        mImg_face = $(R.id.person_face);
        mTv_loc = $(R.id.person_loc);
        mTv_type = $(R.id.person_type);
        check= $(R.id.check_de);
    }

    @Override
    public void setData(final News data) {
        int n =  (int) (Math.random() * 2+1);
        switch (n){
            case 1:
                mTv_brand.setText("品牌：奥玛");
                mTv_loc.setText("车辆型号：XJ-B97898");
                mTv_type.setText("安装时间：2015/08/09");
              //  mTv_type.setTextColor(Color.parseColor("#009900"));

                break;
            case 2:
                mTv_brand.setText("品牌：飞速");
                mTv_loc.setText("车辆型号：XF-BFWE338");
                mTv_type.setText("安装时间：2015/08/09");
              //  mTv_type.setTextColor(Color.parseColor("#CC0000"));

                break;
            case 3:
                mTv_brand.setText("品牌：速达");
                mTv_loc.setText("车辆型号：RT-BFEETT8");
                mTv_type.setText("安装时间：2014/09/09");
             //   mTv_type.setTextColor(Color.parseColor("#CC0000"));

                break;

            default:
                break;
        }
           if(getDataPosition()==0) {
               check.setVisibility(View.VISIBLE);
           }else {
               check.setVisibility(View.GONE);
           }
        //     mTv_name.setText(data.getTitle());
       // mTv_sign.setText(data.getCtime());
        mTv_sign.setText("购买时间：2014/04/09");

        Glide.with(getContext())
                .load(R.mipmap.ic_launcher)
                .placeholder(R.mipmap.ic_launcher)
                .centerCrop()
                .into(mImg_face);
    }
    /*public  void setInvisibleItem(int postion){
        for ()
    }*/
}
